import $mRouter from '@/common/router/router.js'
import $mRoutesConfig from '@/common/router/routes.config.js'

export default {

	/*
	    idx:跳转的编号,
	    params:跳转的需要携带的参数,
	*/
	navigateToIdx(idx, params) {
		var allNavIdx = {
			'100001': ['test', 'index'], 
			'200001': ['test', 'index1'], 
			'200002': ['test', 'index2'], 
			'200003': ['test', 'index3'], 
			'200004': ['test', 'pagen'], 
			'200005': ['test', 'pagen1'],
			'200006': ['test', 'pagen2'],
		}

		console.log("idx: " + idx);
		console.log("params: ", params);
		console.log("allNavIdx: " + allNavIdx[idx]);

		if (!allNavIdx[idx]) {
			idx = '100001';
		}

		var routeObj = $mRoutesConfig;

		for (let s of allNavIdx[idx]) {
			routeObj = routeObj[s]
		}
		console.log(routeObj,'-----routeObj')

		$mRouter.push({
			route: routeObj,
			query: {
				...params
			}
		})
	}

}
